package day20160811;

import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class Gson20160811 {

	public static void main(String[] args) {
		testFromJsonStr();
	}

	private static void testFromJsonStr() {
		Gson gson = new Gson();
		GsonBuilder gb = new GsonBuilder();
		Gson gson2 = gb.setPrettyPrinting().create();
		try{
			Reader reader = new FileReader("2.json");
			Jsontest f2 = gson.fromJson(reader, Jsontest.class);
			System.out.println(gson.toJson(f2));
			System.out.println(gson2.toJson(f2));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
